/* 
 * File:   UniApoFile.h
 * Author: jeffrey
 *
 * Created on May 26, 2010, 11:32 PM
 */

#ifndef _UNIAPOFILE_H
#define	_UNIAPOFILE_H

#include <string>
#include <sstream>
#include "Basic.h"

using namespace std;

class UniApoFile {

public:
    UniApoFile();
    UniApoFile(const UniApoFile& orig);
    virtual ~UniApoFile();
    string getFilename();
    string getFileType();
    string getPath();

private:

protected:
    void setPath();
    string filename;
    string extension;
    string path;
    string scriptpath;


};

UniApoFile::UniApoFile() {

}

UniApoFile::UniApoFile(const UniApoFile& orig) {
    filename = orig.filename;
    extension = orig.extension;
    path = orig.path;
    
}

UniApoFile::~UniApoFile() {
}

string UniApoFile::getFilename(){
    return filename;
}

string UniApoFile::getFileType(){
    return extension;
}
void UniApoFile::setPath() {
    
    char *p = NULL;
    p = getcwd(NULL, 0); // Get full absolute MAPpath
    string p2 = p;
    string::size_type loc3 = p2.find("UniApo/", 0);
    stringstream fpath;
    fpath << p2.substr(0, loc3 + 7) << "Saves/" << extension.c_str();
    fpath << "/" << filename.c_str() << "." << extension.c_str();
    path = fpath.str();
    fpath.str("");
    fpath << p2.substr(0, loc3 + 7) << "Scripts/" ;
    scriptpath = fpath.str();

}

string UniApoFile::getPath(){
    return path;
}

#endif	/* _UNIAPOFILE_H */

